<?php

namespace app\index\controller;

use liang\MicroEngine;
use app\index\logic\Banner as BannerLogic;

/**
 * 公众号前端
 */
class Index extends Base
{
    /**
     * 前端入口
     */
    public function index()
    {
        if (MicroEngine::isMicroEngine()) {
            // 微擎版
            $i = MicroEngine::getUniacid();
            $m = MicroEngine::getModuleName();
            return view('/index', compact('m', 'i'));
        } else {
            return view('/index');
        }
    }

    /**
     * 首页数据
     */
    public function data()
    {
        $banner = BannerLogic::getIndexLists();
        $api = [
            'banner' => $banner,
        ];
        return data($api, '首页');
    }
}
